<extend name="Base:base"/>
<block name="header"></block>
<block name="footer">
    <script>
    
    
    	
        function login() {
         
            $.ajax({
                url: "{$data['root']}/account/ajaxLogin/",
                type: "POST",
                dataType: "JSON",
                data: {
                    account: $("#account").val(),
                    code: $("#code").val(),
                    password: $("#password").val()
                },
                /*
                complete:function(xhr,ts){
                alert(ts);
                alert(xhr);
                },
                */
                success: function (data) {
                    //alert(data.message);
                    //alert(data.code);
                    if (data.code == "1") {
                        if ($("#redirect").val() == "") {
                            window.location.href = "{$data['root']}/";
                        } else {
                            window.location.href = $("#redirect").val();
                        }

                    }
                    else
                    {
                    	alert(data.message);
                    	$('#imgcode').attr("src", '/index.php?m=&c=Account&a=verify_c'+'&random='+Math.random());
                    	$('#code').val("");
                    }

                }
            });
        }

		
        $(document).ready(function () {
            $("#submit").on("click", function () {
           
                login();
            });
            $('#account').keydown(function (e) {
                if (e.keyCode == 13) {
                    login();
                }
            });
            $('#password').keydown(function (e) {
                if (e.keyCode == 13) {
                    login();
                }
            });
            
            
            $("#imgcode").on("click", function () {
                $('#imgcode').attr("src", '/index.php?m=&c=Account&a=verify_c'+'&random='+Math.random());
            });
            
        });    
            
		    
            
            
            
        
        
        
        
    </script>
</block>
<block name="main">
    <div class="ShareAnyContainer" style="font-size: 14px;">
        当前位置：<a href="{$data['root']}/" title="首页">首页</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a
            href="{$data['root']}/account/login/" title="登录">登录</a>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer">
        <div class="line"></div>
    </div>
    <div class="ShareAnySeparate"></div>
    <div class="ShareAnyContainer form" style="line-height: 50px; text-align: center;">
        <style>
            .form input{
                width:300px;
                padding:5px;
            }
            .form input:focus{
                border:1px solid #ff0000;
            }
        </style>
        
        
        
        <table align="center" border='0'>
        <tr><td style="text-align:left">账号：</td><td><input type="text" id="account"></td></tr>
        <tr><td style="text-align:left">密码：</td><td><input type="password" id="password"></td></tr>
        <tr >
        <td style="text-align:left">验证码：</td>
        <td style="vertical-align: top;">
        <input type="text" id="code" width="200px" style="width: 142px; ">
        <img width="100px" height="40px" id="imgcode" alt="验证码"  src="{:U('Account/verify_c',array())}"  title="点击刷新" style="vertical-align: bottom;">
        </td>
        </tr>
        </table>
        <div  style="vertical-align: top; height:50px;">
        
        
        
         
        </div>
        
                
        <p>
            <button id="submit" style="padding:10px 25px;">登录</button>
        </p>
        <p><a href="{$data['root']}/account/find/" title="找回密码">找回密码</a></p>
    </div>
    <input type="hidden" id="redirect" value="{$data['redirect']}">
</block>